package modelo;

import hbt.AbstractHibernateManager;

import org.hibernate.HibernateException;
import org.hibernate.Session;
import entities.CajaEntity;

public class CajaDao  extends AbstractHibernateManager {

	private static CajaDao instancia = null;
	
	public static CajaDao getInstancia() {
		if(instancia == null) {
			instancia = new CajaDao();
		}
		return instancia;
	}
		public void merge (CajaEntity caja){
			Session s = null;
			try {
				s=getNewSession();
				s.beginTransaction();
				s.merge(caja);
				s.flush();
				s.getTransaction().commit();
				System.out.println("[Caja SAVED ON TABLE cajas]::OK");
			} catch (HibernateException e) {
				e.printStackTrace();
			} finally{
				closeSession(s);
			}
		}

}
